﻿<%@ Page Language="C#" MasterPageFile="~/Game/Game.Master" AutoEventWireup="true"
    CodeBehind="Agreements.aspx.cs" Inherits="smallDeimos.Game.Agreements" Title="Small Deimos - Agreements" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:Label ID="Label2" runat="server" Text=""></asp:Label>
    <table>
        <tr>
            <th>
                <h3>
                    Trade agreements
                </h3>
            </th>
        </tr>
        <tr>
            <td>
                <asp:Label ID="Label1" runat="server" Text="Player name:"></asp:Label><asp:TextBox
                    ID="TextBox1" runat="server"></asp:TextBox>
                <asp:Button ID="Button1" runat="server"
                        Text="Send invitation" onclick="Button1_Click" />
            </td>
        </tr>
        <tr>
            <td>
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
                    Width="400px" onrowdatabound="GridView1_RowDataBound">
                    <Columns>
                        <asp:BoundField DataField="From" HeaderText="From" SortExpression="From" />
                        <asp:BoundField DataField="To" HeaderText="To" SortExpression="To" />
                        <asp:TemplateField HeaderText="Status" SortExpression="Status">
                            <EditItemTemplate>
                                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Status") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="Label1" runat="server" Text='<%#StatusDescription(Eval("Status")) %>'></asp:Label>
                                <asp:Button
                                    ID="Button2" runat="server" Text="Accept" onclick="Button2_Click" />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <EmptyDataTemplate>
                        You have no TA&#39;s.
                    </EmptyDataTemplate>
                </asp:GridView>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:smallDeimosConnectionString %>"
                    SelectCommand="SELECT (SELECT PlayerName FROM Players WHERE (PlayerId = Agreements.pId1)) AS [From], (SELECT PlayerName FROM Players AS Players_1 WHERE (PlayerId = Agreements.pId2)) AS [To], Status, Type FROM Agreements WHERE (Type = @Type) AND (pId1 = @pId1) OR (Type = @Type) AND (pId2 = @pId2)">
                    <SelectParameters>
                        <asp:Parameter DefaultValue="0" Name="Type" Type="Int32" />
                        <asp:CookieParameter CookieName="sd_id" Name="pId1" Type="Int32" />
                        <asp:CookieParameter CookieName="sd_id" Name="pId2" Type="Int32" />
                    </SelectParameters>
                </asp:SqlDataSource>
            </td>
        </tr>
        <tr>
            <th>
                <h3>
                    Science agreement
                </h3>
            </th>
        </tr>
        <tr>
            <td>
            </td>
        </tr>
    </table>
</asp:Content>
